const getDefaultState = () => {
  return {
    brandAllInfo: new FormData(),// 真正上传的信息
    brandForm: {
      categoryId: [],
      brandName: '',// 品牌名
      describe: '',// 描述
      state: 1,// 状态
    },
    //brandImg: new FormData()// 品牌图片
  }
}

//准备state，用于存储数据，菜品
const state = getDefaultState()

//准备mutations，用于操作数据 state，厨师
const mutations = {
  //state:数据  value:传进来的参数
  reset: (state) => {
    Object.assign(state, getDefaultState())
  },

  clearBrandAllInfo: (state) => {
    state.brandAllInfo = new FormData();
  },

  setBrandAllInfo: (state, value) => {
    console.log("setAllInfo ", value)
    state.brandAllInfo.append(value.key, value.value);
  },

  setCategoryId: (state, value) => {
    console.log("setCategoryId ", value)
    state.brandForm.categoryId = value;
  },


}

//准备actions，用于响应组件的动作，服务员
const actions = {

}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
